package com.liao.seckill.controller;

import com.liao.seckill.rabbitmq.MQSender;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author lzp
 * @version 1.0
 * lzpnb!
 */

@Controller
public class RabbitMQHandler {

    @Resource
    private MQSender mqSender;


    @RequestMapping("/mq")
    @ResponseBody
    public void mq(){
        mqSender.send("hello world");
    }

    @RequestMapping("/mq/fanout")
    @ResponseBody
    public void fanout(){
        mqSender.sendFanout("hello world2");
    }

    @RequestMapping("/mq/direct01")
    @ResponseBody
    public void direct01(){
        mqSender.sendDirect1("hello direct01");
    }

    @RequestMapping("/mq/direct02")
    @ResponseBody
    public void direct02(){
        mqSender.sendDirect2("hello direct02");
    }

    @RequestMapping("/mq/topic01")
    @ResponseBody
    public void topic01(){
        mqSender.sendTopic01("hello topic01");
    }

    @RequestMapping("/mq/topic02")
    @ResponseBody
    public void topic02(){
        mqSender.sendTopic02("hello topic02 and topic 01");
    }

    @RequestMapping("/mq/header01")
    @ResponseBody
    public void header01(){
        mqSender.sendHeaders01("hello header01 and header02");
    }

    @RequestMapping("/mq/header02")
    @ResponseBody
    public void header02(){
        mqSender.sendHeaders02("hello header01 ");
    }

}
